package com.yitao.client.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * 货币汇率常用枚举
 *
 * @Date: 2019/9/18 14:39
 * @Author: Kien
 */
public class ExchangeRateEnum {

    /**
     *
     * 功能描述: 货币缩写
     *
     * @date: 2019/9/18 14:42
     */
    public enum CURRENCY_ABBREVIATION{
        USD("USD", "美元"),
        CNY("CNY", "人民币"),
        AUD("AUD", "澳元"),
        CAD("CAD", "加拿大元"),
        GBP("GBP", "英镑")
        ;

        private String abbreviation; // 缩写
        private String name; // 中文名
        private static Map<String, String> map = new HashMap<>();

        static {
            for(ExchangeRateEnum.CURRENCY_ABBREVIATION currency_abbreviation: ExchangeRateEnum.CURRENCY_ABBREVIATION.values()){
                map.put(currency_abbreviation.getAbbreviation(), currency_abbreviation.getName());
            }
        }

        CURRENCY_ABBREVIATION(String abbreviation, String name){
            this.abbreviation = abbreviation;
            this.name = name;
        }

        public String getAbbreviation() {
            return abbreviation;
        }

        public void setAbbreviation(String abbreviation) {
            this.abbreviation = abbreviation;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        /**
         *
         * 功能描述: 根据缩写获取中文名称
         *
         * @param
         * @return
         * @auther: Kien
         * @date: 2019/9/18 16:59
         */
        public static String getNameByAbbreviation(String abbreviation){
            return map.get(abbreviation);
        }
    }

    public enum BANK_ABBREVIATION{
        BOC("BOC", "中国银行");

        private String abbreviation; // 缩写
        private String name; // 中文名
        private static Map<String, String> map = new HashMap<>();

        static {
            for(ExchangeRateEnum.BANK_ABBREVIATION bank_abbreviation: ExchangeRateEnum.BANK_ABBREVIATION.values()){
                map.put(bank_abbreviation.getAbbreviation(), bank_abbreviation.getName());
            }
        }

        BANK_ABBREVIATION(String abbreviation, String name){
            this.abbreviation = abbreviation;
            this.name = name;
        }

        public String getAbbreviation() {
            return abbreviation;
        }

        public void setAbbreviation(String abbreviation) {
            this.abbreviation = abbreviation;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        /**
         *
         * 功能描述: 根据缩写获取中文名称
         *
         * @param
         * @return
         * @auther: Kien
         * @date: 2019/9/18 17:00
         */
        public static String getNameByAbbreviation(String abbreviation){
            return map.get(abbreviation);
        }
    }


}
